package com.yejiarong.common.validate.annotation;

import com.yejiarong.common.validate.ValueOptionValidate;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * @author YeJR
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = ValueOptionValidate.class)
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
public @interface ValueOption {

    String[] values();

    boolean multiple() default false;

    String message() default "参考范围：{values}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    @Documented
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
    @interface List {
        ValueOption[] value();
    }
}